/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package legadee2petri;

import java.io.File;
import java.io.IOException;
import javax.xml.parsers.*;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;

/**
 *
 * @author Fabricio
 */
class XML {
    private Document doc;
    private GameScenario gs;

    void parseFile(File xmlfile) {
        DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
        DocumentBuilder dBuilder;
        try {
            dBuilder = dbFactory.newDocumentBuilder();
            doc = dBuilder.parse(xmlfile);
        } catch (ParserConfigurationException ex) {
            System.err.println("ERROR: "+ex.getMessage());
        } catch (SAXException ex) {
            System.err.println("ERROR: "+ex.getMessage());
        } catch (IOException ex) {
            System.err.println("ERROR: "+ex.getMessage());
        }
        doc.getDocumentElement().normalize();
        gs.initialize(doc.getElementsByTagName("GameScenario").item(0));
    }
    public Document getDoc() {
        return doc;
    }

}
